import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { HttpModule } from '@angular/http';

import { MyApp } from './app.component';
import { TabsPage } from '../pages/tabs/tabs';
import { HomePage } from '../pages/home/home';
import { MessagesPage } from '../pages/messages/messages';
import { ContactsPage } from '../pages/contacts/contacts';
import { AboutPage } from '../pages/about/about';
import { TutorialPage } from '../pages/tutorial/tutorial';

import { Api } from '../providers/api';
import { Items } from '../mocks/providers/items'

//列出所有的项目页面，方便angular后期注入
let pages=[
  MyApp,
  TabsPage,
  HomePage,
  MessagesPage,
  ContactsPage,
  AboutPage,
  TutorialPage
];

//列出需要提供的服务
let providers=[
  Api,
  Items,
  StatusBar,
  SplashScreen,
  {provide: ErrorHandler, useClass: IonicErrorHandler}//开启这个方便开发期间调试
];

//列出需要导入的模块
let imports = [
  BrowserModule,
  HttpModule,
  IonicModule.forRoot(MyApp)
];

@NgModule({
  declarations: pages,
  imports: imports,
  bootstrap: [IonicApp],
  entryComponents: pages,
  providers:providers
})
export class AppModule {}
